Management of migrating threads within a computing environment to transform multiple threading mode processors to single thread mode processors

ABSTRACT

Threads of a computing environment are managed to improve system performance. Threads are migrated between processors to take advantage of single thread processing mode, when possible. As an example, inactive threads are migrated from one or more processors, potentially freeing-up one or more processors to execute an active thread. Active threads are migrated from one processor to another to transform multiple threading mode processors to single thread mode processors.

BACKGROUND

An aspect of the invention relates, in general, to processing within acomputing environment, and in particular, to facilitating management ofthreads within the computing environment.

A thread typically exists within a process, and a process may havemultiple threads that share resources, such as memory. A thread isconsidered the smallest unit of processing that can be scheduled by anoperating system. A thread can execute on a processor with no otherthreads executing thereon or on a processor with other threads. In thecase where the thread is the only thread executing on the processor, theprocessor is said to be executing in single thread mode. However, in thecase in which the thread is executing with other threads, the processoris said to be in simultaneous multithreading (SMT) mode.

In simultaneous multithreading mode, hardware resources are shared amongmultiple software threads executing on a machine. Each thread appears tohave its own complete set of architecture hardware. Furthermore, insuperscalar processors, it is common to have multiple executionpipelines that can be shared among the threads being dispatched into thehardware. Though SMT provides an efficiency of hardware, allowingmultiple threads to rapidly share the execution resources available, itcomes with a performance cost of the individual threads. It is commonfor a thread that is alone on a processor to execute more rapidly thanif that thread shared resources with another thread. This is becausewith SMT there may be resource contention issues between threads, andoften a processor in SMT mode must limit what resources are available toeach thread. For example, a processor with two floating point pipelinesmight only be able to use one floating point pipeline for a particularthread in SMT mode even if no other thread is using the second floatingpoint pipeline. In contrast, if the processor was not in SMT mode, thatthread can make use of both floating point pipelines.

BRIEF SUMMARY

Shortcomings of the prior art are overcome and additional advantages areprovided through the provision of a computer system for facilitatingmanagement of threads in a computing environment. The computer systemincludes a memory; and a processor in communications with the memory,wherein the computer system is configured to perform a method. Themethod includes, for instance, detecting, by a hardware controller ofthe computing environment, a change in state of a first processor,wherein the state relates to at least one thread of the first processor;and based on the detecting, providing an indication by the hardwarecontroller to an entity of the computing environment that one or morethreads of the first processor are to be migrated from the firstprocessor to at least one second processor to enable at least one of thefirst processor or another processor to transform from a multithreadingprocessor mode to a single thread processor mode.

Methods and computer program products relating to one or more aspects ofthe present invention are also described and claimed herein. Further,services relating to one or more aspects of the present invention arealso described and may be claimed herein.

Additional features and advantages are realized through the techniquesof one or more aspects of the present invention. Other embodiments andaspects of the invention are described in detail herein and areconsidered a part of the claimed invention.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

One or more aspects of the present invention are particularly pointedout and distinctly claimed as examples in the claims at the conclusionof the specification. The foregoing and other objects, features, andadvantages of one or more aspects of the invention are apparent from thefollowing detailed description taken in conjunction with theaccompanying drawings in which:

FIG. 1A depicts one embodiment of a computing environment to incorporateand use one or more aspects of the present invention;

FIG. 1B depicts further details of the central processors of FIG. 1A, inaccordance with an aspect of the present invention;

FIG. 2A depicts one embodiment of multiple processors executing multiplethreads, in accordance with an aspect of the present invention;

FIG. 2B depicts one example of the processors of FIG. 2A after one ormore aspects of the present invention have been applied to theprocessors, in accordance with an aspect of the present invention;

FIG. 3 depicts one embodiment of the logic associated with swappingthreads from one processor to another, in accordance with an aspect ofthe present invention; and

FIG. 4 depicts one embodiment of a computer program productincorporating one or more aspects of the present invention.

DETAILED DESCRIPTION

In accordance with an aspect of the present invention, a capability isprovided for managing threads of a computing environment. In oneexample, threads are migrated between processors in order to takeadvantage of single thread processor mode, when possible. For example,inactive threads (e.g., sleeping threads, waiting threads, etc.) orthreads entering an inactive state may be migrated from a firstprocessor to at least one second processor to enable either the firstprocessor or another processor to transform from multithreading mode tosingle thread mode. This on-demand thread migration allows overallsystem performance to increase due to more threads running in singlethread processor mode.

One embodiment of a computing environment to incorporate and use one ormore aspects of the present invention is described with reference toFIG. 1A. A computing environment 100 is based, for instance, on thez/Architecture® offered by International Business Machines Corporation,Armonk, N.Y. The z/Architecture® is described in an IBM Publicationentitled, “z/Architecture—Principles of Operation,” IBM® Publication No.SA22-7832-08, Ninth Edition, August 2010, which is hereby incorporatedherein by reference in its entirety. In one example, a computingenvironment based on the z/Architecture® includes a System z® serveroffered by International Business Machines Corporation, Armonk, N.Y.IBM®, z/Architecture® and System z®, as well as z/OS® mentioned below,are registered trademarks of International Business MachinesCorporation, Armonk, N.Y. Other names used herein may be registeredtrademarks, trademarks or product names of International BusinessMachines Corporation or other companies.

As one example, computing environment 100 includes a central processorcomplex (CPC) 102 coupled to an input/output (I/O) subsystem 120.Central processor complex 102 includes, for instance, one or morepartitions 104 (e.g., logical partitions LP1-LPN), one or more centralprocessors 106, a hypervisor 108 (e.g., a logical partition manager),and a system controller 110, each of which is described below.

Each logical partition 104 is capable of functioning as a separatesystem. That is, each logical partition can be independently reset,initially loaded with an operating system, if desired, and operate withdifferent programs. An operating system or application program runningin a logical partition appears to have access to a full and completesystem, but in reality, only a portion of it is available. A combinationof hardware and firmware keeps a program in a logical partition frominterfering with a program in a different logical partition. This allowsseveral different logical partitions to operate on a single processor ormultiple physical processors in a time-sliced manner.

As used herein, firmware includes, e.g., the microcode, millicode,and/or macrocode of the processor. It includes, for instance, thehardware-level instructions and/or data structures used inimplementation of higher level machine code. In one embodiment, itincludes, for instance, proprietary code that is typically delivered asmicrocode that includes trusted software or microcode specific to theunderlying hardware and controls operating system access to the systemhardware.

In this particular example, each logical partition has a residentoperating system 112, which may differ for one or more logicalpartitions. In one embodiment, operating system 112 is the z/OS®operating system, offered by International Business MachinesCorporation, Armonk, N.Y. Further, in this example, each logicalpartition has assigned thereto a portion of system main storage(memory), which is referred to as a zone.

A logical partition 104 includes one or more logical processors. Eachlogical processor may have a central processor 106 permanently allocatedthereto, or there may be a pool of central processors 106 available fordynamic allocation to any group of logical processors, possibly spanningmultiple logical partitions 104.

Logical partitions 104 are managed by hypervisor 108 implemented, forinstance, by firmware running on processors 106. Logical partitions 104and hypervisor 108 each comprise one or more programs residing inrespective portions of main storage associated with the centralprocessor. One example of hypervisor 108 is the ProcessorResource/Systems Manager™ (PR/SM), offered by International BusinessMachines Corporation, Armonk, N.Y.

Central processors 106 are coupled to, but separate from, systemcontroller 110. System controller 110 is, for instance, a hardwarecomponent that controls access to memory and caches within the centralprocessors, and communicates between the central processors andinput/output subsystem 120. The system controller is responsible for thequeuing, serialization, and execution of requests made by the centralprocessors and the I/O subsystem. In one example, it is responsible forsending commands to particular central processors and/or broadcastingcommands to multiple central processors. The system controller may be acentralized component or its functions may be distributed. The systemcontroller is not a processor or core; for example, it does not executeuser applications. Instead, it is the communications mechanism betweenthe I/O subsystem and the central processors.

Further details regarding central processors 106 are described withreference to FIG. 1B. In one example, a central processor 106 includesone or more cores or processors 150, which are the physical processorsthat are allocated to one or more logical partitions. A centralprocessor is considered part of a node, and each node includes one ormore central processors. A logical partition can span nodes in which oneor more central processors from one node and one or more centralprocessors from another node can be assigned to the logical partition.

Further, in accordance with an aspect of the present invention, centralprocessor 106 includes a controller 160 (e.g., hardware controller) usedto monitor the processors, and in particular, the threads executing onthe processors, as described in further detail herein.

As depicted in FIG. 2A, one or more of the processors can be executed insimultaneous multithreading (SMT) mode and one or more of the processorsmay be executed in non-simultaneous multithreading (non-SMT) mode, alsoreferred to as single thread mode. For instance, in FIG. 2A, ProcessorsA and D are executing in simultaneous multithreading mode and ProcessorsB and C are executing in non-simultaneous multithreading mode.

In accordance with an aspect of the present invention, a technique isprovided for migrating a processor from simultaneous multithreading modeto single thread mode in order to improve system performance. This isdescribed in further detail with reference to FIGS. 2A-2B and FIG. 3. Inone example, it is controller 160 (FIG. 1B) that detects that a changeis to be made and provides an indication of that change, as described infurther detail below. In a further example, the controller can beresident on one or more of the processors.

Continuing with FIG. 2A, in this particular example, four processors aredepicted, including Processor A executing in SMT mode, Processor Bexecuting in non-SMT mode, Processor C executing in non-SMT mode, andProcessor D executing in SMT mode. Processor A has two active threads,Threads 1 and 2; Processor B has a thread that is changing from anactive state to an inactive state (e.g., idle or sleeping state), Thread3; Processor C has a thread that is retiring, Thread 6; and Processor Dhas two sleeping threads, Threads 4 and 5, and an active thread, Thread7. Controller 106 monitors the processors and obtains informationregarding the threads on the processors. For example, a hypervisor maykeep controller 106 informed of the activity state of a thread (e.g., byan indicator or bit), or the thread itself may set a wait state bit inthe processor (e.g., in a Program Status Word) that is then communicatedto the controller. In a further example, a hardware component, e.g., acounter, is used to keep count of instructions being dispatched and/orcompleted on the thread, and a timer observes this counter. If thecounter is not updated in a particular amount of time (e.g., 1microsecond, ½ or 1/10 of a microsecond, etc.), it indicates there is noactivity on the thread. This indication is provided to the controller.

From this information, the controller provides an indication of one ormore threads that are to be moved from one or more processors to one ormore other processors to improve system performance. To make thisdetermination, controller 106 analyzes various factors including, butnot limited to, the types of threads (e.g., active, inactive) executingon the processors and whether movement of a thread would enable aprocessor to execute in single thread mode. One embodiment of thisanalysis is described with reference to FIG. 3.

Referring to FIG. 3, in one embodiment, the controller monitors theprocessors, STEP 300, and obtains information regarding the types ofthreads running on the processors. For example, it detects thatProcessor A has two active threads; Processor B has one thread enteringthe inactive state; Processor C has a retiring thread; and Processor Dhas two inactive threads and one active thread.

A determination is made as to whether there are any inactive threads orthreads entering an inactive state that can be moved, INQUIRY 302. Forinstance, the controller recognizes that the only thread on Processor Bis in the process of entering the inactive (e.g., idle or sleeping)state, and if that thread is moved, then one of the threads (e.g.,Thread 2) from Processor A can be moved to Processor B so that bothProcessor A and Processor B are executing in non-SMT mode. Therefore,the controller provides an indication either to the operating system ofProcessor B or to a hypervisor or any other control mechanism thatThread 3 is to be moved to another processor, STEP 304. In this example,it recommends that it be moved to Processor D, since Processor D alreadyincludes sleeping threads.

Thereafter, or if there are no inactive threads or threads enteringinactive state to be moved, the controller determines whether there areany active threads to be moved, INQUIRY 306. In this determination, thecontroller considers whether there are any processors that are notexecuting any threads, and therefore, could accept a thread to execute.In this particular example, after Thread 3 is moved to Processor D, thenProcessor B has no threads to execute, and therefore, a thread, such asThread 2, can be moved from Processor A to Processor B. Further, whenThread 6 retires on Processor C, then Processor C also includes noexecuting threads, and therefore, Thread 7 which is the only activethread on Processor D can be moved to Processor C. Thus, an indicationis provided to the one or more operating systems, the hypervisor orother control mechanism, to move the active threads, STEP 308. Otherexamples also exist.

Responsive to an indication to move a thread, either an inactive thread,a thread entering an inactive state or an active thread, the operatingsystem, hypervisor or control mechanism moves the thread. In oneexample, thread migration begins with stopping the thread, assuming itis active. Then, a millicode routine, hypervisor routine or hardwarecontroller, as examples, on the source processor can then be used tostore the thread state information out to memory. Once complete, amillicode routine, hypervisor routine or hardware controller, asexamples, on the target processor is then used to read the threadinformation out of memory into the target processor. Once the threadinformation is loaded onto the target processor, the thread is thenreturned to its current state and processing continues on the targetprocessor.

Returning to INQUIRY 306, if there are no active threads to be moved,processing is complete. This processing may be performed on a periodicbasis (e.g., every X minutes or seconds, every update to the controller,etc.) continually, or based on a trigger, as examples.

While one embodiment of this technique considers consolidating inactivethreads or threads entering inactive state on one or more processors andattempting to have active threads execute in single thread mode, whenpossible, other considerations may be taken into account. Further, inother embodiments, threads may be moved for performance reasons even ifthe target processor is not going to execute in non-SMT mode, after themove. Many factors may be considered without departing from the spiritof one or more aspects of the present invention.

Responsive to performing the moves, in this particular example, theprocessors include the threads as indicated in FIG. 2B. For example,Processor A is now executing in non-SMT mode and has one active thread,Thread 1; Processor B is also executing in non-SMT mode and has oneactive thread, Thread 2; Processor C, which is also executing in non-SMTmode has one active thread, Thread 7; and Processor D is executing inSMT mode and has three sleeping threads, Threads 3, 4 and 5.

By swapping the threads as indicated, overall system performance ismaximized by enabling multiple processors to run in single thread mode.Threads in a sleep state or entering a sleep state (or other inactivestate), which is entered into when a thread completes its current taskand is waiting for an external interrupt to wake it to execute anothertask (e.g., command), can be swapped out of cores with active threadsallowing the processors those threads are executing on to switch out ofSMT mode, and thus, improve overall system performance. Furthermore,active threads can be moved from one processor to another, if the oneprocessor has multiple active threads and the second processor has noactive threads because, for instance, the previously active thread justterminated.

In a further embodiment, if two threads are thrashing on the samehardware (e.g., floating point unit), the thrashing can be used as astimulus to activate thread migration. Hardware thrashing detectors cansignal to the controller or hypervisor that the threads should bemigrated to a different core to improve system performance. Othercriteria may also be used to migrate a thread. Although, in examplesherein, the policy for rebalancing threads is based on performance, thepolicy for rebalancing can also be based on other criteria, such asthermal concerns.

In yet a further embodiment, thread migration may be used to migrate aprocessor from single thread mode to multithreading mode or to addanother thread to a processor already in multithreading mode. Forinstance, controller 106 may monitor the memory access characteristic ofeach thread on a processor to determine if multiple threads on multipledifferent processors share the same memory access characteristics suchthat system performance can be improved by migrating the threads withsimilar memory access characteristics to the same processor. Otherconsiderations may also be taken into account.

As will be appreciated by one skilled in the art, one or more aspects ofthe present invention may be embodied as a system, method or computerprogram product. Accordingly, one or more aspects of the presentinvention may take the form of an entirely hardware embodiment, anentirely software embodiment (including firmware, resident software,micro-code, etc.) or an embodiment combining software and hardwareaspects that may all generally be referred to herein as a “circuit,”“module” or “system”. Furthermore, one or more aspects of the presentinvention may take the form of a computer program product embodied inone or more computer readable medium(s) having computer readable programcode embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readablestorage medium. A computer readable storage medium may be, for example,but not limited to, an electronic, magnetic, optical, electromagnetic,infrared or semiconductor system, apparatus, or device, or any suitablecombination of the foregoing. More specific examples (a non-exhaustivelist) of the computer readable storage medium include the following: anelectrical connection having one or more wires, a portable computerdiskette, a hard disk, a random access memory (RAM), a read-only memory(ROM), an erasable programmable read-only memory (EPROM or Flashmemory), an optical fiber, a portable compact disc read-only memory(CD-ROM), an optical storage device, a magnetic storage device, or anysuitable combination of the foregoing. In the context of this document,a computer readable storage medium may be any tangible medium that cancontain or store a program for use by or in connection with aninstruction execution system, apparatus, or device.

Referring now to FIG. 4, in one example, a computer program product 400includes, for instance, one or more non-transitory computer readablestorage media 402 to store computer readable program code means or logic404 thereon to provide and facilitate one or more aspects of the presentinvention.

Program code embodied on a computer readable medium may be transmittedusing an appropriate medium, including but not limited to, wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for one or moreaspects of the present invention may be written in any combination ofone or more programming languages, including an object orientedprogramming language, such as Java, Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language, assembler or similar programming languages. Theprogram code may execute entirely on the user's computer, partly on theuser's computer, as a stand-alone software package, partly on the user'scomputer and partly on a remote computer or entirely on the remotecomputer or server. In the latter scenario, the remote computer may beconnected to the user's computer through any type of network, includinga local area network (LAN) or a wide area network (WAN), or theconnection may be made to an external computer (for example, through theInternet using an Internet Service Provider).

One or more aspects of the present invention are described herein withreference to flowchart illustrations and/or block diagrams of methods,apparatus (systems) and computer program products according toembodiments of the invention. It will be understood that each block ofthe flowchart illustrations and/or block diagrams, and combinations ofblocks in the flowchart illustrations and/or block diagrams, can beimplemented by computer program instructions. These computer programinstructions may be provided to a processor of a general purposecomputer, special purpose computer, or other programmable dataprocessing apparatus to produce a machine, such that the instructions,which execute via the processor of the computer or other programmabledata processing apparatus, create means for implementing thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of one or more aspects of the present invention. In thisregard, each block in the flowchart or block diagrams may represent amodule, segment, or portion of code, which comprises one or moreexecutable instructions for implementing the specified logicalfunction(s). It should also be noted that, in some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts, or combinations of special purpose hardware andcomputer instructions.

In addition to the above, one or more aspects of the present inventionmay be provided, offered, deployed, managed, serviced, etc. by a serviceprovider who offers management of customer environments. For instance,the service provider can create, maintain, support, etc. computer codeand/or a computer infrastructure that performs one or more aspects ofthe present invention for one or more customers. In return, the serviceprovider may receive payment from the customer under a subscriptionand/or fee agreement, as examples. Additionally or alternatively, theservice provider may receive payment from the sale of advertisingcontent to one or more third parties.

In one aspect of the present invention, an application may be deployedfor performing one or more aspects of the present invention. As oneexample, the deploying of an application comprises providing computerinfrastructure operable to perform one or more aspects of the presentinvention.

As a further aspect of the present invention, a computing infrastructuremay be deployed comprising integrating computer readable code into acomputing system, in which the code in combination with the computingsystem is capable of performing one or more aspects of the presentinvention.

As yet a further aspect of the present invention, a process forintegrating computing infrastructure comprising integrating computerreadable code into a computer system may be provided. The computersystem comprises a computer readable medium, in which the computermedium comprises one or more aspects of the present invention. The codein combination with the computer system is capable of performing one ormore aspects of the present invention.

Although various embodiments are described above, these are onlyexamples. For example, computing environments of other architectures canincorporate and use one or more aspects of the present invention.Further, a central processor may include more or less processors thandescribed herein. Yet further, processors may include more or lessthreads than described herein. Yet further, the processors need not bepart of a central processor. Moreover, in another embodiment, threadsmay be moved from a processor of one central processor to a processor ofanother central processor. Still further, other factors may be takeninto consideration when deciding whether a thread is to be moved. Manyother changes may also be made.

Further, other types of computing environments can benefit from one ormore aspects of the present invention. As an example, an environment mayinclude an emulator (e.g., software or other emulation mechanisms), inwhich a particular architecture (including, for instance, instructionexecution, architected functions, such as address translation, andarchitected registers) or a subset thereof is emulated (e.g., on anative computer system having a processor and memory). In such anenvironment, one or more emulation functions of the emulator canimplement one or more aspects of the present invention, even though acomputer executing the emulator may have a different architecture thanthe capabilities being emulated. As one example, in emulation mode, thespecific instruction or operation being emulated is decoded, and anappropriate emulation function is built to implement the individualinstruction or operation.

In an emulation environment, a host computer includes, for instance, amemory to store instructions and data; an instruction fetch unit tofetch instructions from memory and to optionally, provide localbuffering for the fetched instruction; an instruction decode unit toreceive the fetched instructions and to determine the type ofinstructions that have been fetched; and an instruction execution unitto execute the instructions. Execution may include loading data into aregister from memory; storing data back to memory from a register; orperforming some type of arithmetic or logical operation, as determinedby the decode unit. In one example, each unit is implemented insoftware. For instance, the operations being performed by the units areimplemented as one or more subroutines within emulator software.

As a further example, a data processing system suitable for storingand/or executing program code is usable that includes at least oneprocessor coupled directly or indirectly to memory elements through asystem bus. The memory elements include, for instance, local memoryemployed during actual execution of the program code, bulk storage, andcache memory which provide temporary storage of at least some programcode in order to reduce the number of times code must be retrieved frombulk storage during execution.

Input/Output or I/O devices (including, but not limited to, keyboards,displays, pointing devices, DASD, tape, CDs, DVDs, thumb drives andother memory media, etc.) can be coupled to the system either directlyor through intervening I/O controllers. Network adapters may also becoupled to the system to enable the data processing system to becomecoupled to other data processing systems or remote printers or storagedevices through intervening private or public networks. Modems, cablemodems, and Ethernet cards are just a few of the available types ofnetwork adapters.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising”, when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below, if any, areintended to include any structure, material, or act for performing thefunction in combination with other claimed elements as specificallyclaimed. The description of the present invention has been presented forpurposes of illustration and description, but is not intended to beexhaustive or limited to the invention in the form disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the invention.The embodiment was chosen and described in order to best explain theprinciples of one or more aspects of the invention and the practicalapplication, and to enable others of ordinary skill in the art tounderstand one or more aspects of the invention for various embodimentswith various modifications as are suited to the particular usecontemplated.

What is claimed is:
 1. A computer system for migrating threads between aplurality of processors of a computing environment, said computer systemcomprising: a memory; and a processor in communications with the memory,wherein the computer system is configured to perform a method, saidmethod comprising: monitoring, by a hardware controller of the computingenvironment, a plurality of processors to obtain information regarding aplurality of threads on the plurality of processors, the monitoringdetecting a change in a state of a thread on a processor of theplurality of processors, the change in state indicating a change from anactive state to a state other than the active state; determining, basedon detecting the change in the state of the thread, whether at least onethread of the plurality of threads is to be migrated from at least oneprocessor to at least one other processor to transform one or moreprocessors of the plurality of processors from a multithreadedprocessing mode to a single thread processor mode, wherein thedetermining analyzes a plurality of factors including: types of threadsexecuting on the plurality of processors, the types of threads includingone or more of active, inactive, retiring, or entering inactive threads;and whether movement of the at least one thread transforms the one ormore processors to single thread processor mode; and based on thedetermining, providing an indication by the hardware controller to anentity of the computing environment that the at least one thread is tobe migrated from the at least one processor to the at least one otherprocessor to enable at least one processor of the one or more processorsto transform from a multithreading processor mode to a single threadprocessor mode.
 2. The computer system of claim 1, wherein the providingthe indication comprises providing an indication that the threadchanging from the active state is to be migrated, and wherein subsequentto migration, the processor from which the thread is migrated has nothreads thereon enabling an active thread to be migrated there such thatthe processor from which the thread is migrated and another processorfrom which the active thread is migrated are processing in a singlethread processor mode.
 3. The computer system of claim 1, wherein thedetecting the change in state of the thread comprises detecting that thethread is entering an inactive state.
 4. The computer system of claim 3,wherein the thread entering the inactive state comprises the threadentering a sleeping state.
 5. The computer system of claim 1, whereinthe entity comprises a hypervisor of the computing environment or anoperating system of a processor of the computing environment.
 6. Thecomputer system of claim 1, wherein the method further comprises:detecting by the hardware controller that an active thread is to bemoved from one processor to another processor; and providing anindication to the entity or another entity that the active thread is tobe moved.
 7. The computer system of claim 6, wherein the detecting thatthe active thread is to be moved is based on a migration of one or morethreads from the another processor resulting in the another processorhaving no threads.
 8. The computer system of claim 7, wherein thedetecting that the active thread is to be moved is further based on adetermination that movement of the active thread transforms the oneprocessor to a single thread processor mode.
 9. The computer system ofclaim 1, wherein the method further comprises moving the at least onethread from the at least one processor to the at least one otherprocessor.
 10. The computer system of claim 9, wherein the methodfurther comprises moving one or more active threads, if any, from aselected processor of the at least one other processor, wherein theselected processor exclusively includes inactive threads or threadsentering an inactive state.
 11. A computer program product for migratingthreads between a plurality of processors of a computing environment,said computer program product comprising: a non-transitory computerreadable storage medium readable by a processing circuit and storinginstructions for execution by the processing circuit for performing amethod comprising: monitoring, by a hardware controller of the computingenvironment; a plurality of processors to obtain information regarding aplurality of threads on the plurality of processors, the monitoringdetecting a change in a state of a thread on a processor of theplurality of processors, the change in state indicating a change from anactive state to a state other than the active state; determining, basedon detecting the change in the state of the thread, whether at least onethread of the plurality of threads is to be migrated from at least oneprocessor to at least one other processor to transform one or moreprocessors of the plurality of processors from a multithreadedprocessing mode to a single thread processor mode, wherein thedetermining analyzes a plurality of factors including: types of threadsexecuting on the plurality of processors, the types of threads includingone or more of active, inactive, retiring, or entering inactive threads;and whether movement of the at least one thread transforms the one ormore processors to single thread processor mode; and based on thedetermining, providing an indication by the hardware controller to anentity of the computing environment that the at least one thread is tobe migrated from the at least one processor to the at least one otherprocessor to enable at least one processor of the one or more processorsto transform from a multithreading processor mode to a single threadprocessor mode.
 12. The computer program product of claim 11, whereinthe providing the indication comprises providing an indication that thethread changing from the active state is to be migrated, and whereinsubsequent to migration, the processor from which the thread is migratedhas no threads thereon enabling an active thread to be migrated theresuch that the processor from which the thread is migrated and anotherprocessor from which the active thread is migrated are processing in asingle thread processor mode.
 13. The computer program product of claim11, wherein the method further comprises: detecting by the hardwarecontroller that an active thread is to be moved from one processor toanother processor; and providing an indication to the entity or anotherentity that the active thread is to be moved.
 14. The computer programproduct of claim 13, wherein the detecting that the active thread is tobe moved is based on a migration of one or more threads from the anotherprocessor resulting in the another processor having no threads.
 15. Thecomputer program product of claim 14, wherein the detecting that theactive thread is to be moved is further based on a determination thatmovement of the active thread transforms the one processor to a singlethread processor mode.
 16. The computer program product of claim 11,wherein the detecting the change in state of the thread comprisesdetecting that the thread is entering an inactive state.
 17. Thecomputer program product of claim 16, wherein the thread entering theinactive state comprises the thread entering a sleeping state.
 18. Thecomputer program product of claim 11, wherein the entity comprises ahypervisor of the computing environment or an operating system of aprocessor of the computing environment.
 19. The computer program productof claim 11, wherein the method further comprises moving the at leastone thread from the at least one processor to the at least one otherprocessor.
 20. The computer program product of claim 19, wherein themethod further comprises moving one or more active threads, if any, froma selected processor of the at least one other processor, wherein theselected processor exclusively includes inactive threads or threadsentering an inactive state.